# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=blackarch-dwm
pkgver=6.2
pkgrel=1
pkgdesc='Dynamic window manager for X with BlackArch colors.'
arch=('x86_64' 'aarch64')
url='https://dl.suckless.org/dwm/'
license=('GPL')
depends=('dmenu' 'xorg-server' 'xorg-xsetroot' 'libx11' 'libxinerama')
conflicts=('dwm')
provides=('dwm')
source=("https://dl.suckless.org/dwm/dwm-$pkgver.tar.gz"
        'config.h'
        'blackarch-dwm')
sha512sums=('01abcab954e5b7c20d011e6fd9c28025271fea2e85610c928812f7c6a09f99d7f9e93d11ffc2d6a7aca894b3fa7e507c6c2fe5f26ff5ddcfc650a9bbaaa41e06'
            '6b079086c1c08c4680d1e166d182677c568f5735c7dcbb0059d6477bd3a39cd64de63d3a7ae0de62a8617535ed375737164065dabe2638a4ca32fe8d776e8061'
            '04de6142754785ae3d2e1d606be4166b48d5c50e1d651bd92c43933822d523533a826ebcededec03fc790b597c7b1640b57c6de208113655512af8b977f47366')

prepare(){
  cd "dwm-$pkgver"

  cp -f "$srcdir/config.h" .

  sed -i 's/CPPFLAGS =/CPPFLAGS +=/g' config.mk
  sed -i 's/^CFLAGS = -g/#CFLAGS += -g/g' config.mk
  sed -i 's/^#CFLAGS = -std/CFLAGS += -std/g' config.mk
  sed -i 's/^LDFLAGS = -g/#LDFLAGS += -g/g' config.mk
  sed -i 's/^#LDFLAGS = -s/LDFLAGS += -s/g' config.mk
}

build() {
  cd "dwm-$pkgver"

  make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11
}

package() {
  cd "dwm-$pkgver"

  make PREFIX=/usr DESTDIR="$pkgdir" install

  install -m 755 "$srcdir/blackarch-dwm" "$pkgdir/usr/bin/"
}

